import http from '@/utils/http'

class API {
	static api = new API()
	// 用户信息
	async getUserinfo() {
		const res = await http.get('/ivmcr/member/userInfo', {}, {
			auth: true
		})

		return res

		// console.log('🚀 ~ API ~ getUserinfo ~ res:', res)
		// uni.setStorageSync('userinfo', res.data)

		// setTimeout(() => {
		// 	if (res.data.is_vip == 0 || res.data.is_set == 0) {
		// 		jumpTo('/pages/login/code')
		// 	}
		// }, 800)

	}

	// 设置用户信息
	async setUserinfo({
		code,
		name: realname,
		sex,
		avatar
	}) {
		return await http.put(
			'/ivmcr/member/updateUserInfo', {
				code,
				sex,
				avatar,
				realname,
			}, {
				auth: true
			}
		)
	}

	//用户详情
	async getUserBase(member_id) {
		return await http.get("/ivmcr/member/getUserInfo", {
			member_id
		}, {
			auth: true
		})
	}

	//需求详情
	async examinationInfo() {
		return await http.get("/ivmcr/member/examinationInfo", {}, {
			auth: true
		})
	}
	
	// 需求详情 没有需求内容
	async getExaminationInfo(days) {
		return await http.get("/ivmcr/member/getexaminationInfo", {days}, {
			auth: true
		})
	}
}

export default API.api